package com.wxm.question.q1;

import java.util.Arrays;
import java.util.List;

public class Test {
    public static void main(String[] args) {
        TreeNode treeNode11 = new TreeNode(11, null);

        List<TreeNode> node12_children = Arrays.asList(new TreeNode(121, null));
        TreeNode treeNode12 = new TreeNode(12, node12_children);
        TreeNode treeNode13 = new TreeNode(13, null);
        List<TreeNode> node1_children = Arrays.asList(treeNode11, treeNode12, treeNode13);
        TreeNode treeNode1 = new TreeNode(1, node1_children);

        TreeNode treeNode21 = new TreeNode(21, null);
        TreeNode treeNode23 = new TreeNode(23, null);
        List<TreeNode> node2_children = Arrays.asList(treeNode21, treeNode23);
        TreeNode treeNode2 = new TreeNode(2, node2_children);

        List<TreeNode> treeNodes = Arrays.asList(treeNode1, treeNode2);

        TreeNode treeNode0 = new TreeNode(0, treeNodes);
        Tree tree = new Tree(treeNode0);

        TreeNode treeNode = new TreeNode(null);
        while (treeNode != null) {
            treeNode = Tree.getNextTreeNode(tree);
            System.out.println(treeNode != null ? treeNode.getId() : "");
        }
    }
}
